#include <iostream>
#include <string>
#include "IpMaskChecker.h"

int main(int argc, char *argv[]) {
	if (argc < 4) {
		std::cout << "Not enough parameters" << std::endl
				<< "Usage: <Mask> <IP1> <IP2>" << std::endl;
		return 0;
	}

	std::string mask, ip1, ip2;
	mask.assign(argv[1]);
	ip1.assign(argv[2]);
	ip2.assign(argv[3]);

	std::cout << "Mask = " << mask << std::endl << "IP1 = " << ip1 << std::endl
			<< "IP2 = " << ip2 << std::endl;

	IpMaskChecker checker;
	Result result = checker.check(mask, ip1, ip2);
	switch (result) {
	case result_yes:
		std::cout << "IP addresses are in the same subnetwork" << std::endl;
		break;
	case result_no:
		std::cout << "IP addresses are in different subnetworks" << std::endl;
		break;
	case result_error:
		std::cout << "IP address or mask is invalid" << std::endl;
	}

}
